package com.itboye.textileexpres.main;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;


import com.itboye.textileexpres.R;
import com.itboye.textileexpres.base.BaseFragment;
import com.itboye.textileexpres.order.FragmentMyOrder;
import com.itboye.textileexpres.order.FragmentOrderReceiptOfGood;
import com.itboye.textileexpres.order.FragmentOrderWanchengGood;
import com.itboye.textileexpres.order.FragmentOrderWhole;
import com.itboye.textileexpres.order.FragmentToBeHippedOrder;
import com.itboye.textileexpres.widget.PagerSlidingTabStrip;

public class RoofFragment extends BaseFragment {
	
	String[] titles = {"全部","待发货", "待收货","已发货","完成"};
	ViewPager pager;
	
	PagerSlidingTabStrip tabs;

	@Override
	public int initView() {
		// TODO Auto-generated method stub
		return R.layout.fragment_roof;
	}

	@Override
	public void onMyActivityCreated() {
		// TODO Auto-generated method stub
		pager.setAdapter(new MyAdapter(getChildFragmentManager(), titles));
		tabs.setViewPager(pager);

	}
	public class MyAdapter extends FragmentStatePagerAdapter {
		String[] _titles;

		public MyAdapter(FragmentManager fm, String[] titles) {
			super(fm);
			_titles = titles;
		}

		@Override
		public CharSequence getPageTitle(int position) {
			return _titles[position];
		}

		@Override
		public int getCount() {
			return _titles.length;
		}

		@Override
		public Fragment getItem(int position) {
			Fragment bfrag2 = null;
			if (position == 0) {
				bfrag2 = new FragmentOrderWhole(0);
			}else if(position==1){
				bfrag2=new FragmentMyOrder(1);// 代付款
			}else if (position==2) {
				bfrag2=new  FragmentToBeHippedOrder(2);// 待发货
			} else if(position==3){
				bfrag2 = new FragmentOrderReceiptOfGood(3);// 待收货
			}else if(position==4){
				bfrag2=new FragmentOrderWanchengGood(4);// 已经完成
			}
			return bfrag2;
		}

		@Override
		public void destroyItem(ViewGroup container, int position, Object object) {
			
			// super.destroyItem(container, position, object);
		}

		@Override
		public void destroyItem(View container, int position, Object object) {
			
			// super.destroyItem(container, position, object);
		}
	}



}
